package com.kltong.inf.dubbo.config;

import org.springframework.context.annotation.Scope;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;

@Scope("singleton")
@DisconfFile(filename = "dubbo.properties")

/**
 * dubbo.appname=ma_ppluspay dubbo.registry=zookeeper://192.168.80.5:2181
 * dubbo.protocol=dubbo dubbo.port=-1
 *
 * @author alvy
 *
 */
public class DubboProperties {
    /**
     * 维护人
     */
    private String appOwner;

    private String appName;

    /**
     * 机构
     */
    private String appOrg;

    /**
     * 注册中心地址
     */
    private String registryAddress;

    /**
     * 注册中心连接超时时间
     */
    private Integer registryTimeout;

    /**
     * 服务默认提供的超时时间
     */
    private Integer providerTimeout;

    /**
     * 服务默认提供的重试次数
     */
    private Integer providerRetries;

    /**
     * 服务默认提供的的负载均衡策略
     */
    private String providerLoadbalance;

    /**
     * 服务默认的拦截扩展
     */
    private String providerFilter;

    /**
     * 线程池数量
     */
    private Integer dubboThreads;

    /**
     * 序列化方式
     */
    private String dubboSerialization;

    /**
     * 远程调用超时时间
     */
    private Integer consumerTimeout;

    /**
     * 远程调用重试次数
     */
    private Integer consumerRetries;

    /**
     * 远程调用负载均衡方式
     */
    private String consumerLoadbalance;

    /**
     * 远程调用默认的调用拦截扩展
     */
    private String consumerFilter;

    /**
     * 默认是否检测服务是否存在
     */
    private boolean consumerCheck;

    /**
     * 服务端口号
     *
     * @return
     */
    private Integer port;

    /**
     * 提供者传输大小限制
     */
    private Integer providerPayload;

    @DisconfFileItem(name = "dubbo.port", associateField = "port")

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    @DisconfFileItem(name = "app.owner", associateField = "appOwner")
    public String getAppOwner() {
        return appOwner;
    }

    public void setAppOwner(String appOwner) {
        this.appOwner = appOwner;
    }

    @DisconfFileItem(name = "app.org", associateField = "appOrg")
    public String getAppOrg() {
        return appOrg;
    }

    public void setAppOrg(String appOrg) {
        this.appOrg = appOrg;
    }

    @DisconfFileItem(name = "dubbo.registry", associateField = "registryAddress")
    public String getRegistryAddress() {
        return registryAddress;
    }

    public void setRegistryAddress(String registryAddress) {
        this.registryAddress = registryAddress;
    }

    @DisconfFileItem(name = "registry.timeout", associateField = "registryTimeout")
    public Integer getRegistryTimeout() {
        return registryTimeout;
    }

    public void setRegistryTimeout(Integer registryTimeout) {
        this.registryTimeout = registryTimeout;
    }

    @DisconfFileItem(name = "provider.timeout", associateField = "providerTimeout")
    public Integer getProviderTimeout() {
        return providerTimeout;
    }

    public void setProviderTimeout(Integer providerTimeout) {
        this.providerTimeout = providerTimeout;
    }

    @DisconfFileItem(name = "provider.retries", associateField = "providerRetries")
    public Integer getProviderRetries() {
        return providerRetries;
    }

    public void setProviderRetries(Integer providerRetries) {
        this.providerRetries = providerRetries;
    }

    @DisconfFileItem(name = "provider.loadbalance", associateField = "providerLoadbalance")
    public String getProviderLoadbalance() {
        return providerLoadbalance;
    }

    public void setProviderLoadbalance(String providerLoadbalance) {
        this.providerLoadbalance = providerLoadbalance;
    }

    @DisconfFileItem(name = "provider.filter", associateField = "providerFilter")
    public String getProviderFilter() {
        return providerFilter;
    }

    public void setProviderFilter(String providerFilter) {
        this.providerFilter = providerFilter;
    }

    @DisconfFileItem(name = "dubbo.threads", associateField = "dubboThreads")
    public Integer getDubboThreads() {
        return dubboThreads;
    }

    public void setDubboThreads(Integer dubboThreads) {
        this.dubboThreads = dubboThreads;
    }

    @DisconfFileItem(name = "dubbo.serialization", associateField = "dubboSerialization")
    public String getDubboSerialization() {
        return dubboSerialization;
    }

    public void setDubboSerialization(String dubboSerialization) {
        this.dubboSerialization = dubboSerialization;
    }

    @DisconfFileItem(name = "consumer.timeout", associateField = "consumerTimeout")
    public Integer getConsumerTimeout() {
        return consumerTimeout;
    }

    public void setConsumerTimeout(Integer consumerTimeout) {
        this.consumerTimeout = consumerTimeout;
    }

    @DisconfFileItem(name = "dubbo.appname")
    public String getAppName() {
        return appName;
    }

    @DisconfFileItem(name = "consumer.retries", associateField = "consumerRetries")
    public Integer getConsumerRetries() {
        return consumerRetries;
    }

    public void setConsumerRetries(Integer consumerRetries) {
        this.consumerRetries = consumerRetries;
    }

    @DisconfFileItem(name = "consumer.loadbalance", associateField = "consumerLoadbalance")
    public String getConsumerLoadbalance() {
        return consumerLoadbalance;
    }

    public void setConsumerLoadbalance(String consumerLoadbalance) {
        this.consumerLoadbalance = consumerLoadbalance;
    }

    @DisconfFileItem(name = "consumer.filter", associateField = "consumerFilter")
    public String getConsumerFilter() {
        return consumerFilter;
    }

    public void setConsumerFilter(String consumerFilter) {
        this.consumerFilter = consumerFilter;
    }

    @DisconfFileItem(name = "consumer.check", associateField = "consumerCheck")
    public boolean isConsumerCheck() {
        return consumerCheck;
    }

    public void setConsumerCheck(boolean consumerCheck) {
        this.consumerCheck = consumerCheck;
    }

    @DisconfFileItem(name = "provider.payload", associateField = "providerPayload")
    public Integer getProviderPayload() {
        return providerPayload;
    }

    public void setProviderPayload(Integer providerPayload) {
        this.providerPayload = providerPayload;
    }
}